<?php 
	include("header.php");
	include("top_menu.php");
?>

<title> Available Devices </title>

<div class = "showavailabledevices">
	<?php
		$connection = mysql_pconnect("localhost" , "root" , "31122001");
    	mysql_select_db("kt_site");
    	$query = "SELECT * FROM device_type;";    	
		$sql = mysql_query($query);
		echo "<form name = 'deleteavailavledevices' action = 'adddevice.php' method = 'POST'>";
		echo "<div class = 'div-header div-header-sad'>";
		echo "<div id = 'div-header-sad-c1'> Device type </div>";
		echo "</div>";
		for ($i = 0 ; $i < mysql_num_rows($sql) ; $i++) {
			$device = mysql_fetch_array($sql);
			echo "<div class = 'div-row-sad'>";
			echo "<div id = 'div-row-sad-c1'> <input type = 'checkbox' name = 'devicestodelete[]' value = '".$device['id']."'> </div>";
			echo "<div id = 'div-row-sad-c2'>".$device['name']."</div><br>";
			echo "</div>";
		}
		echo "<input type = 'submit' name = 'delete' value = 'Delete choosen devices' class = 'button button-delete-device'>";
		echo "<input type = 'submit' name = 'add' value = 'Add new device' class = 'button button-add-device'/>";
		echo "</form>";
	?>
	
		
	
</div>